package com.sf.wc.controller;


import java.util.List;
import java.util.Map.Entry;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.sf.wc.filereader.TxtFileReader;
import com.sf.wc.wordcount.WordCountResolver;
import com.sf.wc.wordfilter.ChineseWordFilter;
import com.sf.wc.wordfilter.WordFilter;

/**
 * 描述：
 * 
 * <pre>HISTORY
 * ****************************************************************************
 *  ID   DATE           PERSON          REASON
 *  1    2017年12月5日      Simba.Hua         Create
 * ****************************************************************************
 * </pre>
 * @author Simba.Hua
 */
@Controller
public class ChineseWordCountController {
	@Autowired
	@RequestMapping("/index")
	public ModelAndView index(){
		ModelAndView mv = new ModelAndView();
		
		TxtFileReader fileReader = TxtFileReader.getInstance();
		WordFilter wordFilter = new ChineseWordFilter();
		WordCountResolver resolver = new WordCountResolver(fileReader,wordFilter);
		List<Entry<Character, Integer>> result = resolver.resolver();
		mv.addObject("list", result);
		mv.setViewName("index");
		return mv;
	}
}
